package cn.yuan.quartz.jobs;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

public class PrintTimeJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //获取JobDetail中关联的数据
        String timeStr = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss sss").format(new Date());
        JobDataMap dateMap = jobExecutionContext.getJobDetail().getJobDataMap();
        Object str = dateMap.get("params");
        System.out.println(timeStr+"================="+str);
    }
}
